package com.zzy.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author weiyuan
 */
@RestController
@RequestMapping("/api/test")
public class TestController {

    /**
     * 动态刷新需开启 @RefreshScope
     */
    @Value(value = "${test.value}")
    private String testValue;

    @GetMapping("/test")
    public Object test() {
        Map<String, String> map = new HashMap<>(8);
        map.put("userName", "zhangsan");
        map.put("userId", "1");
        map.put("testValue", testValue);
        return map;
    }


}
